Run Tests | CLI Interface

Call phptest or vendor/bin/phptest from your project's root dir.

A globally installed phptest will execute the vendor/bin/phptest copy if it exists.

phptest # simply run tests  
  
phptest init # Create test dir & example test files  
  
phptest server # launch test server using default settings  
phptest server server_name # launch a configured server  
phptest server -host.override "https://example.com" # typically server tests will use a localhost address. This overrides the host in all tests, even if you have a multi-server setup.  
  
phptest -test TestName # Run one test; display all output for the named test  
phptest -test TestName -test Another Test # Run all named tests  
phptest -class ClassName # Run all tests for a class. Do not include namespace. Can include multiple classes.  
  
phptest -custom_key SomeValue # For any tests that allow custom input from CLI.  

Other Options:

-class ClassName -test TestName # Only run TestName for the given ClassName  
-prettyPrintArray true # Not sure if this works. To print array comparisons on multiple lines. By default output is condensed.  
-set_error_handler false # Not sure if this works. Enable the built-in error handler that causes all warnings, etc, to throw an exception.  
-bench.threshold 0.001 # Only print benchmark for tests taking longer than 1 ms to run. `0.001` is configurable.